package Poly;

import java.util.ArrayList;

// 功夫大侠（父类）
class KungFuMaster {
    private String name;
    private String kindName;
    protected ArrayList <String> list = new ArrayList<>(4);
    // private long forceValue; 武力值 —— 暂未开发

    public KungFuMaster(String name, String kindName) {
        this.name = name;
        this.kindName = kindName;
    }
    public String getInfo() {
        return this.kindName.concat(this.name);
    }

    public void setSkill() {}
    public void kill(int k, CultPerson cultPerson) {
        System.out.println("[" + getInfo() + "]向" + cultPerson.getInfo() + "使用技能" + k + list.get(k));
        cultPerson.beKilled();
    }
}

// 魔教徒（父类）
class CultPerson {
    private String name;
    private String kindName;
    protected String crySound;

    public CultPerson(String name, String kindName) {
        this.name = name;
        this.kindName = kindName;
    }
    public String getInfo() {
        return this.kindName.concat(this.name);
    }

    public void setCrySound(String crySound) {
        this.crySound = crySound;
    }

    public void beKilled() {
        System.out.println('[' + getInfo() + ']' + this.crySound);
    }
}

// 少林大侠（子类）
class ShaolinMaster extends KungFuMaster {
    public ShaolinMaster(String name, String kindName) {
        super(name, "少林派");
    }

    public void setSkill() {
        list.add("铁头功");
        list.add("五毒追砂掌");
        list.add("螳螂爪");
        list.add("金铲指");
    }
}

// 日月神教（子类）
class sunMoonCult extends CultPerson {
    public sunMoonCult(String name, String kindName) {
        super(name, "日月神教");
    }
}

public class Main {
    public static void main(String[] args) {
        KungFuMaster master = new ShaolinMaster("玄慈", null);
        CultPerson cultPerson1 = new sunMoonCult("东方不败", null);
        CultPerson cultPerson2 = new sunMoonCult("向问天", null);
        cultPerson1.setCrySound("日出东方，唯我不败。我一定会回来的...");
        cultPerson2.setCrySound("公道不在人心，是非全靠实力。可恶，是我输了...");
        master.setSkill();
        master.kill(2, cultPerson1);
        master.kill(3, cultPerson2);
    }
}
